package com.t3go.t3_map.utils;

/**
 * T3服务器接口返回的交通状态
 */
public enum TrafficLevel {
    /**
     * 内部路线
     */
    UNKNOWN(0),
    /**
     * 畅通
     */
    SMOOTH(1),
    /**
     * 缓慢
     */
    SLOW(2),
    /**
     * 堵
     */
    JAM(3),
    /**
     * 很堵
     */
    VERY_JAM(4);

    private final int level;

    TrafficLevel(int level) {
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    public static TrafficLevel getTrafficLevel(int level) {
        for (TrafficLevel traffic : TrafficLevel.values()) {
            if (traffic.getLevel() == level) {
                return traffic;
            }
        }
        return TrafficLevel.UNKNOWN;
    }
}
